package com.mystudy.concurrent.singleton;

/**
 * TODO:使用枚举的方式
 *
 * @author acy
 * @since 2019/05/16 13:50
 */
public class SingletonObjectThree {

	private SingletonObjectThree() {
	}

	private enum Singleton{
		INSTANCE;
		private final SingletonObjectThree instance;

		//构造函数只会被装载一次
		Singleton(){
			instance=new SingletonObjectThree();
		}

		public SingletonObjectThree getInstance(){
			return instance;
		}
	}

	public static SingletonObjectThree getInstance(){
		return Singleton.INSTANCE.getInstance();
	}
}
